﻿using DayuCode.Designer.Entity;
using DayuCode.Designer.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DayuCode.Designer.Service
{
    public class ProjectCatalogHandler
    {
		private static string getBaseUrl(string methodName)
		{
			return AppInstance.ApiServer + "api/base/dayucode_projectCatalogHandler/" + methodName;
		}

		public static void deleteProjectCatalog(long id)
		{
			QHttpClient.Execute(getBaseUrl("deleteProjectCatalog"), new { id = id });
		}

		public static ProjectCatalog saveProjectCatalog(ProjectCatalog item)
		{
			ProjectCatalog obj = QHttpClient.Post<ProjectCatalog>(getBaseUrl("saveProjectCatalog"), new { item = item });
			return obj;
		}

		//public static IList<ProjectCatalog> getProjectCatalogs()
		//{
		//	IList<ProjectCatalog> obj = QHttpClient.Post<List<ProjectCatalog>>(getBaseUrl("getProjectCatalogs"), new { });
		//	return obj;
		//}

		public static IList<ProjectCatalog> getChildProjectCatalogs(long pId)
		{
			IList<ProjectCatalog> obj = QHttpClient.Post<List<ProjectCatalog>>(getBaseUrl("getChildProjectCatalogs"), new { pId = pId});
			return obj;
		}

		public static ProjectCatalog getProjectCatalog(long id)
		{
			ProjectCatalog obj = QHttpClient.Post<ProjectCatalog>(getBaseUrl("getProjectCatalog"), new { id = id });
			return obj;
		}



	}
}
